package cn.cdm.config;

import cn.cdm.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author qinxubang
 * @Date 2022/6/8 9:21
 */

//@Configuration
public class MyWebConfigurer implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")       // "/**", 表示所有请求都被拦截包括静态资源
                .excludePathPatterns("/","/login", "/login/to_login", "/login/do_login", "/qin-html",
                        "/error/**", "/error", "/css/**","/fonts/**",
                        "/images/**", "/img/**", "/js/**","/static/**",
                        "/layer/**", "/jquery-validation/**", "/bootstrap/**"); //放行的请求

    }

}
